package com.coda.app.controller;

import com.coda.app.mapper.BrowsingHistoryMapper;
import com.coda.app.service.BrowsingHistoryService;
import com.coda.result.PageResult;
import com.coda.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/app/history")
@Api(tags = "浏览历史")
public class BrowsingHistoryController {

    @Autowired
    private BrowsingHistoryService browsingHistoryService;

    /**
     * 分页查询浏览历史
     */
    @GetMapping("/pageItem")
    @ApiOperation("分页查询浏览历史")
    public Result<PageResult> getHistory(@RequestParam Integer current,
                                         @RequestParam Integer size) {
        PageResult pageResult = browsingHistoryService.getHistory(current, size);
        return Result.ok(pageResult);
    }
}
